﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}

<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
<script src="~/lib/layui/layui.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>报工新增</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="//unpkg.com/layui@2.9.21-rc/dist/css/layui.css" rel="stylesheet">
</head>
<body>
    <div class="layui-row" style="margin-bottom: 20px;">
        <div class="layui-col-sm3">
            <label class="layui-form-label">工单</label>
            <div class="layui-input-inline">
                <select lay-verify="required" id="workSheetId" placeholder="工单">
                    <option value="">请选择</option>
                    <option value="1">工单</option>
                </select>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">工序名称</label>
            <div class ="layui-input-inline">
                <select  lay-verify="required" placeholder="工序名称" disabled>
                    <option value="">工序名称</option>
                </select>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">产品</label>
            <div class="layui-input-inline">
                <select lay-verify="required"  placeholder="产品" disabled>
                    <option value="">产品</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-row" style="margin-bottom: 20px;">
        <div class="layui-col-sm3">
            <label class="layui-form-label">产品编号</label>
            <div class="layui-input-block">
                <input type="text" placeholder="产品编号" autocomplete="off" class="layui-input" disabled>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">产品名称</label>
            <div class="layui-input-block">
                <input type="text"placeholder="产品名称" autocomplete="off" class="layui-input" disabled>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">产品规格</label>
            <div class ="layui-input-block">
                <input type="text" placeholder="产品规格" autocomplete="off" class="layui-input" disabled>
            </div>
        </div>
    </div>
    <div class="layui-row" style="margin-bottom: 20px;">
        <div class="layui-col-sm3">
            <label class="layui-form-label">报工数</label>
            <div class="layui-input-block">
                <input type="number" lay-affix="number" placeholder="报工数" step="1" class="layui-input" id="signingNum">
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">生产人员</label>
            <div class="layui-input-inline">
                <select lay-verify="required" placeholder="生产人员" id="produceName" name="produceName">
                    <option value="超级管理员">超级管理员</option>
                    <option value="测试">测试</option>
                </select>
            </div>
            <div class="layui-input-block">
                <input type="text" id="produceName" placeholder="生产人员" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">工序状态</label>
            <div class="layui-input-block">
                <input type="radio" name="processStatus" value="0">未开始
                <input type="radio" name="processStatus" value="1" checked>进行中
                <input type="radio" name="processStatus" value="2">已完成
            </div>
        </div>
    </div>
    <div class="layui-row" style="margin-bottom: 20px;">
        <div class="layui-col-sm3">
            <label class="layui-form-label">单位</label>
            <div class="layui-input-inline">
                <select lay-verify="required" id="unitName" placeholder="单位">
                    <option value="个">个</option>
                    <option value="箱">箱</option>
                    <option value="件">件</option>
                    <option value="套">套</option>
                    <option value="PCS">PCS</option>
                    <option value="只">只</option>
                    <option value="台">台</option>
                    <option value="米">米</option>
                    <option value="条">条</option>
                    <option value="张">张</option>
                    <option value="车">车</option>
                    <option value="天">天</option>
                    <option value="小时">小时</option>
                    <option value="分钟">分钟</option>
                    <option value="周">周</option>
                    <option value="月">月</option>
                </select>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">良品数</label>
            <div class="layui-input-block">
                <input type="text" id="goodNum" placeholder="良品数" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">不良品数</label>
            <div class="layui-input-block">
                <input type="text" id="badNum" placeholder="不良品数" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-row" style="margin-bottom: 20px;">
        <div class="layui-col-sm3">
            <label class="layui-form-label">工序进度</label>
            <div class="layui-input-block">
                <input type="text" placeholder="工序进度" autocomplete="off" class="layui-input" disabled>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">开始时间</label>
            <div class="layui-input-block">
                <input type="datetime-local" id="dateStart" placeholder="开始时间" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">结束时间</label>
            <div class="layui-input-block">
                <input type="datetime-local" id="dateEnd" placeholder="结束时间" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-row" style="margin-bottom: 20px;">
        <div class="layui-col-sm3">
            <label class="layui-form-label">报工时长</label>
            <div class="layui-input-block">
                <input type="number" lay-affix="number" step="1" class="layui-input" id="signingTime">小时
            </div>
        </div>
        <div class="layui-col-sm3">
            <div class="layui-input-block">
                <input type="number" lay-affix="number" step="1" class="layui-input" id="signingMin">
            </div>分钟
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">达标率</label>
            <div class="layui-input-block">
                <input type="text" placeholder="达标率" autocomplete="off" class="layui-input" disabled>
            </div>
        </div>
    </div>
    <div class="layui-row" style="margin-bottom: 20px;">
        <div class="layui-col-sm3">
            <label class="layui-form-label">标准效率</label>
            <div class="layui-input-block">
                <input type="text" id="standard" placeholder="标准效率" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">实际效率</label>
            <div class="layui-input-block">
                <input type="text" id="actual" placeholder="实际效率" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">计价方式</label>
            <div class="layui-input-block">
                <input type="radio" name="pricingType" value="0">计件
                <input type="radio" name="pricingType" value="1">计时
            </div>
        </div>
    </div>
    <div class="layui-row" style="margin-bottom: 20px;">
        <div class="layui-col-sm3">
            <label class="layui-form-label">工资单价</label>
            <div class="layui-input-block">
                <input type="text" placeholder="工资单价" autocomplete="off" class="layui-input" id="wagesPrice">
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">应奖金额</label>
            <div class="layui-input-block">
                <input type="text" placeholder="应奖金额" autocomplete="off" class="layui-input" id="rewardMoney">
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">应罚金额</label>
            <div class="layui-input-block">
                <input type="text" placeholder="应罚金额" autocomplete="off" class="layui-input" id="penalty">
            </div>
        </div>
    </div>
    <button class="layui-btn" id="saveBtn" onclick="postAdd()">保存</button>

    <script src="//unpkg.com/layui@2.9.18/dist/layui.js"></script>
    <script src="//unpkg.com/jquery/dist/jquery.js"></script>
    <script>

        function postAdd() {
            var data={
                workSheetId: $("#workSheetId").val(),
                signingNum: $("#signingNum").val(),
                produceName: $("#produceName").val(),
                processStatus: $("[name=processStatus]:checked").val(),
                unitName: $("#unitName").val(),
                goodNum: $("#goodNum").val(),
                badNum: $("#badNum").val(),
                dateStart: $("#dateStart").val(),
                dateEnd: $("#dateEnd").val(),
                signingTime: $("#signingTime").val(),
                signingMin: $("#signingMin").val(),
                standard: $("#standard").val(),
                actual: $("#actual").val(),
                pricingType: $("[name=pricingType]:checked").val(),
                wagesPrice: $("#wagesPrice").val(),
                rewardMoney: $("#rewardMoney").val(),
                penalty: $("#penalty").val()
            }
            console.log(data);
            $.post({
                url: '@ViewBag.Darius' + "/api/GoldIngot/Handle/SigningCreate",
                data: JSON.stringify(data),
                async: false,
                dataType: "json",
                contentType: "application/json",
                success: res => {
                    console.log(res);
                    if (res.data == 1) {
                        alert("添加成功");
                        layer.closeAll(); // 关闭弹框
                    } else {
                        alert("添加失败");
                    }
                }
            })
        }
       

    </script>     
</body>
</html>
    